package com.weiyuwqj.admin.controller.admin.reward;

import com.weiyuwqj.api.service.BasExperiencedGoldService;
import com.weiyuwqj.api.common.Paginator;
import com.weiyuwqj.api.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by huzj on 2016/8/12.
 */
@Controller
@RequestMapping("/admin/experiencedGold")
public class ExperiencedGoldController {
    @Autowired
    BasExperiencedGoldService experiencedGoldService;

    @ResponseBody
    @RequestMapping(value="/list", method= RequestMethod.POST)
    public Object getList(Paginator p,String username,String beginDate,String endDate,Date useTime,String goldStatus){
        Map map=new HashMap();
        map.put("username",username);
        map.put("beginDate",beginDate);
        map.put("endDate",endDate);
        map.put("goldStatus",goldStatus);
        if(useTime!=null){
            map.put("useBeginTime", DateUtils.getDayStartTime(useTime));
            map.put("useEndTime",DateUtils.getNextDayStartTime(useTime));
        }
        return experiencedGoldService.getList(p,map);
    }
}
